import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";

import "./styles/base.css";
import "./styles/common.css";

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
Vue.use(ElementUI);

import axios from "axios";
Vue.prototype.$http = axios;
import httputil from "./js/httputil.js";
Vue.prototype.httputil = httputil;

import apiConfig from "./js/api.config.js";
axios.defaults.withCredentials = true; //跨域访问需要发送cookie时一定要加
axios.defaults.baseURL = apiConfig.baseUrl; // 配置接口地址

import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
//request请求拦截器 
axios.interceptors.request.use((config) => {
  // 为请求头添加token验证authorization
  // config.headers.token = window.sessionStorage.getItem("token");
  NProgress.start();
  return config;
});
//response响应拦截器
axios.interceptors.response.use(config => {
  NProgress.done()
  return config
})

Vue.filter("currency", function(value) {
  if (value === 1) {
    value="FIL"
  }else if(value === 2){
    value="ACC"
  }else if(value === 3){
    value="USDT"
  }else{
    value='-'
  }
  return value;
});


Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
